package com.lipi.mall.product.config;


import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyRedissonConfig {

    /**
     * 所有对redis的操作都通过RedissonClient
     *
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() {
        Config config = new Config();
        //配置redis地址，可以配置集群方式
        //集群方式：config.useClusterServers().addNodeAddress();

        config.useSingleServer()
                .setAddress("redis://192.168.56.10:6379");
        return Redisson.create(config);
    }

}
